#./sheyang/vioupload/Makefile
SOURCES = $(wildcard *.cpp)
OBJS = $(patsubst %.cpp,%.o,$(notdir $(SOURCES)))
OBJSD = $(addprefix $(TMP_DIR)vioupload/,$(OBJS))

INCLUDE = -I $(PWD)/thirdparty/libuv/include \
		  -I $(PWD)/common/utilc \
		  -I $(PWD)/common/util \
		  -I $(PWD)/common/ludb \
		  -I $(PWD)/uvmodules/uvlogplus \
		  -I $(PWD)/uvmodules/uvnetplus \
		  -I $(PWD)

STATIC_LIB = -L $(OUT_DIR) \
             -l:ludb.a \
			 -l:uvlogplus.a \
			 -l:uvnetplus.a \
			 -l:util.a \
			 -l:utilc.a \
			 -l:libuv.a \
			 -l:lua.a \
			 -l:cjson.a \
			 -l:pugixml.a \
			 -l:libmariadb.a \
			 -l:ocilib.a \
			 -lclntsh -locci \
			 -lrt -lresolv -lssl -lcrypto -lpthread -ldl

SHARED_LIB = -L $(OUT_DIR) \
			 -l:ludb.so \
			 -l:uvlogplus.so \
			 -l:uvnetplus.so \
			 -l:util.so \
			 -l:utilc.so \
             -l:libuv.so \
			 -l:lua.so \
			 -l:cjson.so \
			 -l:pugixml.so \
			 -l:libmariadb.so \
			 -l:ocilib.so \
			 -lrt -lresolv -lssl -lcrypto -lpthread -ldl

all:chkdir vioupload$(TAGTYPE)

chkdir:
	$(shell mkdir -p $(TMP_DIR)vioupload/)

vioupload_static:$(OBJS)
	$(GG) $(OBJSD) -o $(OUT_DIR)vioupload $(STATIC_LIB)

vioupload_shared:$(OBJS)
	$(GG) $(OBJSD) -o $(OUT_DIR)vioupload $(SHARED_LIB)

$(OBJS):%.o:%.cpp
	$(GG) $(INCLUDE) $(GFLAGS) -c $< -o $(TMP_DIR)vioupload/$@

clean:
	rm -rf $(TMP_DIR)vioupload/*.o